package ms.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import ms.jacrim.Constants;

public class Shell {

	public static void execute(String command) throws IOException, InterruptedException {

		ProcessBuilder b = new ProcessBuilder(Constants.CMD_PATH, "/C", command);

		b.redirectErrorStream(true);
		Process lpg = b.start();

		// process output
		InputStream is = lpg.getInputStream();
		InputStreamReader isr = new InputStreamReader(is);
		BufferedReader br = new BufferedReader(isr);
		String line;
		while ((line = br.readLine()) != null) {
			System.out.println(line);
		}
	}
}
